import sys

MSGS = ("aa asd", "aa    ")

def strxor(a, b):     # xor two strings of different lengths
    if len(a) > len(b):
        return "".join([chr(ord(x) ^ ord(y)) for (x, y) in zip(a[:len(b)], b)])
    else:
        return "".join([chr(ord(x) ^ ord(y)) for (x, y) in zip(a, b[:len(a)])])

def random(size=16):
    return open("/dev/urandom").read(size)

def encrypt(key, msg):
    c = strxor(key, msg)
    print
    print c.encode('hex')
    return c

def main():
    key = random(1024)
    ciphertexts = [encrypt(key, msg) for msg in MSGS]
    return ciphertexts
lst = []
for x in range(26):
    lst.append(chr(x + ord('a')))
for x in range(26):
    lst.append(chr(x + ord('A')))

xors = [];
for x in lst:
    for y in lst:
        z0 = strxor(x, y).encode('hex');
        found = False
        for z in xors:
            if z0 == z[0] :
                z[1].append([x,y])
                found = True
                break
        if (not found):
            xors.append([z0, [[x, y]]])
for x in xors:
    res = "" + x[0]
    yy = x[1]
    for y in yy:
        res = res + " " + y[0] + y[1]
    print res
